package tech.yangzhijie.basic.thread;

/**
 * java编程思想 656页练习1
 */
public class PracticeRunnable implements Runnable {

    public PracticeRunnable(){
        System.out.println("创建成功");
    }

    @Override
    public void run() {
        for (int i=0;i<3;i++){
            System.out.println(Thread.currentThread().getName()+"执行"+(i+1));
            Thread.yield();//暂停当前线程，执行其他线程。
        }
        System.out.println(Thread.currentThread().getName()+"线程关闭");
    }
}
